﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AdministrarDocente.aspx.cs"
    Inherits="Ent.Inscripcion.Presentacion.AdministrarDocente" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Administración de Docentes</title>
    <ext:ResourcePlaceHolder ID="ResourcePlaceHolder1" runat="server" Mode="Script" />
    <script type="text/javascript" src="../Resources/Js/EntInscripcion.js"></script>
    
</head>
<body>
    <ext:ResourceManager ID="ResourceManager1" runat="server">
    </ext:ResourceManager>
    <ext:Hidden ID="hidIdDocente" runat="server">
    </ext:Hidden>
    <ext:Hidden ID="hidAccionDocente" runat="server">
    </ext:Hidden>
    <ext:Viewport ID="ViewPort1" runat="server" Layout="Fit">
        <LayoutConfig>
            <ext:VBoxLayoutConfig Align="Stretch" />
        </LayoutConfig>
        <Items>
            <ext:Panel BodyStyle="background-color:transparent;" Padding="10" Border="false"
                runat="server" ButtonAlign="Center">
                <Items>
                    <ext:FormPanel ID="frpDatosBusqueda" BodyStyle="background-color:transparent;" runat="server"
                        Border="false" Layout="Column">
                        <Items>
                            <ext:Panel ID="Panel5" runat="server" ColumnWidth="0.5" Height="60" Border="false"
                                Layout="Form">
                                <Items>
                                    <ext:TextField ID="txtNombreB" runat="server" FieldLabel="Nombre" AnchorHorizontal="90%">
                                    </ext:TextField>
                                    <ext:TextField ID="txtIdentificacionB" runat="server" FieldLabel="Identificación"
                                        AnchorHorizontal="90%">
                                    </ext:TextField>
                                </Items>
                            </ext:Panel>
                            <ext:Panel ID="Panel6" runat="server" ColumnWidth="0.5" Border="false" Layout="Form">
                                <Items>
                                    <ext:TextField ID="txtApellidoB" runat="server" FieldLabel="Apellido" AnchorHorizontal="90%">
                                    </ext:TextField>
                                </Items>
                            </ext:Panel>
                        </Items>
                    </ext:FormPanel>
                </Items>
                <Buttons>
                    <ext:Button ID="btnBuscar" runat="server" Text="Buscar">
                        <DirectEvents>
                            <Click OnEvent="btnBuscar_Click">
                                <ExtraParams>
                                    <ext:Parameter Name="Identificacion" Value="#{txtIdentificacionB}.getValue()" Mode="Raw">
                                    </ext:Parameter>
                                    <ext:Parameter Name="Nombre" Value="#{txtNombreB}.getValue()" Mode="Raw">
                                    </ext:Parameter>
                                    <ext:Parameter Name="Apellido" Value="#{txtApellidoB}.getValue()" Mode="Raw">
                                    </ext:Parameter>
                                </ExtraParams>
                                <EventMask Msg="Buscando Docentes" ShowMask="true" />
                            </Click>
                        </DirectEvents>
                    </ext:Button>
                </Buttons>
            </ext:Panel>
            <ext:GridPanel ID="gpDocentes" runat="server" StripeRows="true" AutoWidth="true"
                AutoExpandColumn="Direccion" Height="600">
                <Store>
                    <ext:Store ID="stoDocentes" runat="server">
                        <Reader>
                            <ext:JsonReader IDProperty="Id">
                                <Fields>
                                    <ext:RecordField Name="Id" />
                                    <ext:RecordField Name="Nombre" />
                                    <ext:RecordField Name="Apellidos" />
                                    <ext:RecordField Name="Identificacion" />
                                    <ext:RecordField Name="Email" />
                                    <ext:RecordField Name="Direccion" />
                                    <ext:RecordField Name="Celular" />
                                    <ext:RecordField Name="Telefono" />
                                </Fields>
                            </ext:JsonReader>
                        </Reader>
                    </ext:Store>
                </Store>
                <TopBar>
                    <ext:Toolbar ID="Toolbar3" runat="server">
                        <Items>
                            <ext:Button ID="Button3" runat="server" Text="Crear Docente" Icon="PageAdd">
                                <Listeners>
                                    <Click Handler="#{winDocente}.show();#{hidAccionDocente}.setValue('Nuevo');" />
                                </Listeners>
                            </ext:Button>
                        </Items>
                    </ext:Toolbar>
                </TopBar>
                <ColumnModel ID="ColumnModel3" runat="server">
                    <Columns>
                        <ext:CommandColumn Width="120">
                            <Commands>
                                <ext:GridCommand CommandName="Editar" Text="Editar" Icon="PageEdit" ToolTip-Text="Editar Docente">
                                </ext:GridCommand>
                                <ext:GridCommand CommandName="Eliminar" Text="Eliminar" Icon="PageDelete" ToolTip-Text="Eliminar Docente">
                                </ext:GridCommand>
                            </Commands>
                        </ext:CommandColumn>
                        <ext:Column Header="Identificación" Width="80" Sortable="true" DataIndex="Identificacion">
                        </ext:Column>
                        <ext:Column Header="Nombre" Width="150" Sortable="true" DataIndex="Nombre" />
                        <ext:Column Header="Apellido" Width="150" Sortable="true" DataIndex="Apellidos" />
                        <ext:Column Header="Email" Width="120" Sortable="true" DataIndex="Email">
                        </ext:Column>
                        <ext:Column Header="Celular" Width="80" Sortable="true" DataIndex="Celular">
                        </ext:Column>
                        <ext:Column Header="Teléfono" Width="80" Sortable="true" DataIndex="Telefono">
                        </ext:Column>
                        <ext:Column ColumnID="Direccion" Header="Dirección" Width="100" Sortable="true" DataIndex="Direccion" />
                    </Columns>
                </ColumnModel>
                <DirectEvents>
                            <Command OnEvent="ManejarAccion">
                        <ExtraParams>
                            <ext:Parameter Name="Comando" Value="command" Mode="Raw" Encode="false" />
                            <ext:Parameter Name="Id" Value="record.data.Id" Mode="Raw" />
                        </ExtraParams>
                    </Command>
                        </DirectEvents>
                <SelectionModel>
                    <ext:RowSelectionModel ID="RowSelectionModel3" runat="server" SingleSelect="true">
                        
                    </ext:RowSelectionModel>
                </SelectionModel>
                <LoadMask Msg="Cargando Datos" ShowMask="true" />
            </ext:GridPanel>
        </Items>
    </ext:Viewport>
    <ext:Window runat="server" ID="winDocente" Layout="Form" ButtonAlign="Center" Resizable="false"
        Hidden="true" Width="700" AutoHeight="true" Modal="true" Closable="true" AutoScroll="true"
        Collapsible="false" Title="Administración de docentes" ConstrainHeader="true"
        Y="5">
        <Items>
            <ext:FormPanel ID="frpDatosDocente" runat="server" Padding="10" AutoWidth="true"
                Height="220" ButtonAlign="Right" Layout="Form">
                <Items>
                    <ext:FieldSet runat="server" Title="Datos Personales" Layout="Column" Height="70">
                        <Items>
                            <ext:Panel ID="Panel1" runat="server" Border="false" Header="false" ColumnWidth=".5"
                                Layout="Form" LabelAlign="Left" Height="60" LabelWidth="75">
                                <Defaults>
                                    <ext:Parameter Name="AllowBlank" Value="false" Mode="Raw" />
                                </Defaults>
                                <Items>
                                    <ext:TextField ID="txtNombres" runat="server" FieldLabel="Nombres" AnchorHorizontal="90%" />
                                    <ext:TextField ID="txtIdentificacion" runat="server" FieldLabel="Identificación"
                                        AnchorHorizontal="90%" />
                                </Items>
                            </ext:Panel>
                            <ext:Panel ID="Panel2" runat="server" Border="false" Layout="Form" ColumnWidth=".5"
                                LabelAlign="Left" Height="60" LabelWidth="75">
                                <Defaults>
                                    <ext:Parameter Name="AllowBlank" Value="false" Mode="Raw" />
                                </Defaults>
                                <Items>
                                    <ext:TextField ID="txtApellidos" runat="server" FieldLabel="Apellidos" AnchorHorizontal="90%" />
                                </Items>
                            </ext:Panel>
                        </Items>
                    </ext:FieldSet>
                    <ext:FieldSet runat="server" Title="Datos de Contacto" Layout="Column" Height="70">
                        <Items>
                            <ext:Panel ID="Panel3" runat="server" Border="false" Header="false" ColumnWidth=".5"
                                Layout="Form" LabelAlign="Left" Height="60" LabelWidth="75">
                                <Defaults>
                                    <ext:Parameter Name="AllowBlank" Value="false" Mode="Raw" />
                                </Defaults>
                                <Items>
                                    <ext:TextField ID="txtTelefono" runat="server" FieldLabel="Teléfono" AnchorHorizontal="90%" />
                                    <ext:TextField ID="txtDireccion" runat="server" FieldLabel="Dirección" AnchorHorizontal="90%" />
                                </Items>
                            </ext:Panel>
                            <ext:Panel ID="Panel4" runat="server" Border="false" Layout="Form" ColumnWidth=".5"
                                LabelAlign="Left" Height="60" LabelWidth="75">
                                <Defaults>
                                    <ext:Parameter Name="AllowBlank" Value="false" Mode="Raw" />
                                    <ext:Parameter Name="MsgTarget" Value="side" />
                                </Defaults>
                                <Items>
                                    <ext:TextField ID="txtCelular" runat="server" FieldLabel="Celular" AnchorHorizontal="90%" />
                                    <ext:TextField ID="txtEmail" runat="server" FieldLabel="Email" Vtype="email" AnchorHorizontal="90%" />
                                </Items>
                            </ext:Panel>
                        </Items>
                    </ext:FieldSet>
                </Items>
            </ext:FormPanel>
        </Items>
        <Buttons>
        <ext:Button runat="server" ID="btnEliminar" Text="Eliminar" Hidden="true" Icon="Delete">
                <DirectEvents>
                            <Click OnEvent="btnEliminar_Click" Failure="ManejarError();"
                                Success="LimpiarForm();#{winDocente}.hide();MostrarMensaje(3,'El Docente se elimino correctamente');">
                                <EventMask ShowMask="true" Msg="Eliminando catalogo" />
                                <ExtraParams>
                                    <ext:Parameter Name="Id" Value="#{hidIdDocente}.getValue()" Mode="Raw" />
                                    </ExtraParams>
                                    <Confirmation Message="Esta seguro de eliminar el catalogo?" ConfirmRequest="true" />
                            </Click>
                        </DirectEvents>
                </ext:Button>
            <ext:Button ID="btnGuardar" runat="server" Text="Guardar" Icon="Add">
                <DirectEvents>
                    <Click Before="return ValidarFormulario(#{frpDatosDocente});" OnEvent="btnGuardar_Click" Failure="ManejarError();"
                                Success="LimpiarForm();#{winDocente}.hide();MostrarMensaje(3,'El Docente se guardo correctamente');">
                        <EventMask ShowMask="true" Msg="Guardando datos" />
                        <ExtraParams>
                            <ext:Parameter Name="Nombre" Value="#{txtNombres}.getValue()" Mode="Raw" />
                            <ext:Parameter Name="Apellido" Value="#{txtApellidos}.getValue()" Mode="Raw" />
                            <ext:Parameter Name="Identificacion" Value="#{txtIdentificacion}.getValue()" Mode="Raw" />
                            <ext:Parameter Name="Telefono" Value="#{txtTelefono}.getValue()" Mode="Raw" />
                            <ext:Parameter Name="Direccion" Value="#{txtDireccion}.getValue()" Mode="Raw" />
                            <ext:Parameter Name="Celular" Value="#{txtCelular}.getValue()" Mode="Raw" />
                            <ext:Parameter Name="Email" Value="#{txtEmail}.getValue()" Mode="Raw" />
                            <ext:Parameter Name="Id" Value="#{hidIdDocente}.getValue()" Mode="Raw" />
                            <ext:Parameter Name="Accion" Value="#{hidAccionDocente}.getValue()" Mode="Raw" />
                        </ExtraParams>
                    </Click>
                </DirectEvents>
            </ext:Button>
            <ext:Button ID="btnCancelar" runat="server" Text="Cancelar"  Icon="Stop">
            <Listeners>
                            <Click Handler="LimpiarForm();#{winDocente}.hide();" />
                        </Listeners>
            </ext:Button>
        </Buttons>
    </ext:Window>

    <ext:XScript ID="XScript1" runat="server">

    <script type="text/javascript">
        var LimpiarForm = function()
        {
            #{frpDatosDocente}.getForm().reset();
            #{btnEliminar}.hide();
            #{btnGuardar}.show();
        };
    </script>
    </ext:XScript>
</body>
</html>
